package com.hoan.component.kotlin

import android.app.Activity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.hoan.component.kotlin.databinding.PopCouponBinding
import com.lxj.xpopup.core.BottomPopupView

/**
 *
 *
 * @author chenqiang
 * @date  2024/5/16
 */
abstract class CouponPop(activity: Activity) : BottomPopupView(activity) {

    override fun getImplLayoutId() = R.layout.pop_coupon

    override fun initPopupContent() {
        super.initPopupContent()
        val binding = PopCouponBinding.bind(popupImplView)

        binding.apply {
            ivClose.setOnClickListener { dismiss() }

            val list = ArrayList<String>()
            list.add("1")
            list.add("1")
            list.add("1")
            list.add("1")
            list.add("1")
            list.add("1")
            val adapterFont = CouponAdapter()
            rvCoupon.apply {
                itemAnimator = null
                layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false)
                adapter = adapterFont.apply {
                    setNewInstance(list)
                }
            }
        }
    }

    abstract fun operate(
        dialog: CouponPop,
        type: Int,
    )

}